import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
df = pd.read_excel('edges_output.xlsx')
u = df['u']
v = df['v']
f = df['f']
G = nx.DiGraph()
for i in range(len(u)):
    if u[i]==v[i]:
        print('hehe')
    else:
        if not G.has_node(u[i]):
            G.add_node(u[i])
        if not G.has_node(v[i]):
            G.add_node(v[i])
        G.add_edge(u[i],v[i],capacity = f[i])
edge_color_list = [(u, v, d['capacity']) for u, v, d in G.edges(data=True)]
capacities = [capacity for u, v, capacity in edge_color_list]
max_capacity = max(capacities)
edge_colors = [plt.cm.autumn((capacity / max_capacity)) for u, v, capacity in edge_color_list]
nx.draw(G, edge_color=edge_colors)
plt.show()



